package cc.lj.internal.merchant.domain.contract.service.impl;

import cc.lj.internal.merchant.domain.contract.model.vo.MerchantContractSignedDO;
import cc.lj.internal.merchant.domain.contract.model.vo.convert.MerchantContractSignedPOConvertDO;
import cc.lj.internal.merchant.domain.contract.repository.IMerchantContractSignedRepository;
import cc.lj.internal.merchant.domain.contract.repository.IPropertyRelationRepository;
import cc.lj.internal.merchant.domain.contract.service.IMerchantContractSignedDomainService;
import cc.lj.internal.merchant.infrastructure.po.MerchantContractSignedPO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 商户合同签订表 domain service 实现
 * @author liangxifeng
 * @date 2022-07-09
 */
@Service(value = "merchantContractSignedDomainServiceImpl")
public class MerchantContractSignedDomainServiceImpl implements IMerchantContractSignedDomainService {
    @Resource(name = "merchantContractSignedMysqlRespository")
    private IMerchantContractSignedRepository repository;

    @Override
    public List<MerchantContractSignedDO> getList(MerchantContractSignedDO signedDO) {
        MerchantContractSignedPO signedPO = MerchantContractSignedPOConvertDO.INSTANCE.convert(signedDO);
        return repository.getList(signedPO).stream().map(x -> MerchantContractSignedPOConvertDO.INSTANCE.convert(x)).collect(Collectors.toList());
    }
}
